package com.zd.web.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.zd.entity.Novel2;
import com.zd.service.MessageService;
import com.zd.service.impl.MessageServiceImpl;

/**
 * Servlet implementation class PlServlet
 */
@WebServlet("/PlServlet")
public class PlServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		System.out.println("woiodsakjasijd");
		request.setCharacterEncoding("UTF-8");
		response.setCharacterEncoding("UTF-8");
		response.setContentType("json/html;charset=UTF-8");
		String context=request.getParameter("context");
		MessageService messageservice=new MessageServiceImpl();
		List<String> list3=messageservice.pl(context);
		String json = JSON.toJSONString(list3);
		System.out.println(json);
		response.getWriter().write(json);
	}
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
